import service from '@/utils/request';

export function GetEnterprise(params: {}) {
  return service({
      url: '/itf/organization/web/enterprise/page',
      method: 'get',
      params
  })
}

// 公司编辑
export function GetEnterpriseUuid(params: { uuid: string }) {
  return service({
      url: '/itf/organization/web/enterprise/uuid/'+ params.uuid,
      method: 'put',
      data: params
  })
}

// 公司新增
export function GetEnterpriseAdd(data: any) {
  return service({
      url: '/itf/organization/web/enterprise',
      method: 'post',
      data
  })
}

// 根据id查询详情
export function GetOrganizationEnterprise(id: any) {
  return service({
      url: '/itf/organization/web/enterprise/' + id,
      method: 'get'
  })
}

/**
 * 公司根据uuid查询详情
 * @param params 
 * @returns 
 */
export function GetEnterpriseInfo(uuid: any) {
  return service({
    url: `/itf/organization/web/enterprise/uuid/${uuid}`,
    method: 'get'
  })
}

// 公司删除
export function DeleteEnterprise(data: { uuid: string }) {
  return service({
      url: '/itf/organization/web/enterprise/uuid/'+ data.uuid,
      method: 'delete'
  })
}

// 公司单元类型
export function GetEnterpriseUnitType(params: {}) {
  return service({
      url: '/itf/organization/web/unit_type',
      method: 'get',
      params
  })
}

// 公司单元类型
export function PutEnterpriseUnitTypeUuid(params: {uuid: string}) {
  return service({
      url: '/itf/organization/web/unit_type/uuid/'+ params.uuid,
      method: 'put',
      data: params
  })
}

// 公司没有分页列表
export function GetEnterpriseList(params: {}) {
  return service({
      url: '/itf/organization/web/enterprise',
      method: 'get',
      params
  })
}

// 查询业务单元树形列表
export function GetBusinessUnitTree(params: {}) {
  return service({
      url: '/itf/organization/web/business_unit/tree',
      method: 'get',
      params
  })
}

// 公司根据uuid查询详情
export function GetEnterpriseDetails(data: { uuid: string }) {
  return service({
      url: '/itf/organization/web/enterprise/uuid/'+ data.uuid,
      method: 'get'
  })
}

// 组织查询列表，不分页
export function GetBusinessUnit(params: {}) {
  return service({
      url: '/itf/organization/web/business_unit',
      method: 'get',
      params
  })
}

// 组织根据uuid查询详情
export function GetBusinessUnitDetails(data: { uuid: string }) {
  return service({
      url: '/itf/organization/web/business_unit/uuid/'+ data.uuid,
      method: 'get'
  })
}

// 组织业务单元根据uuid修改
export function PutBusinessUnitUpdate(data: { uuid: string }) {
  return service({
      url: '/itf/organization/web/business_unit/uuid/'+ data.uuid,
      method: 'put',
      data,
  })
}

// 公司新增
export function PostBusinessUnitAdd(data: any) {
  return service({
      url: '/itf/organization/web/business_unit',
      method: 'post',
      data
  })
}

// 企业岗位查询列表，不分页
export function GetPositionList(params: {}) {
  return service({
      url: '/itf/organization/web/position',
      method: 'get',
      params
  })
}

// 根据名义岗位uuid查询实际岗位列表
export function GetPositionContractList(uuid: any) {
  return service({
      url: '/itf/organization/web/position/contract/uuid/' + uuid,
      method: 'get'
  })
}

// 分页查询列表，不传每页大小默认10条
export function GetPositionPage(params: {}) {
  return service({
      url: '/itf/organization/web/position/page',
      method: 'get',
      params
  })
}

// 字典
export function GetCodeDict(params: {}) {
  return service({
      url: '/itf/general/web/dict/data',
      method: 'get',
      params
  })
}

// 企业岗位 新增
export function PostPositionAdd(data: {}) {
  return service({
      url: '/itf/organization/web/position',
      method: 'post',
      data
  })
}

// 企业岗位删除
export function DeletePosition(data: { uuid: string }) {
  return service({
      url: '/itf/organization/web/position/uuid/'+ data.uuid,
      method: 'delete'
  })
}

// 企业岗位编辑
export function GetPositionUuid(params: { uuid: string }) {
  return service({
      url: '/itf/organization/web/position/uuid/'+ params.uuid,
      method: 'put',
      data: params
  })
}

// 根据uuid查询父级bu名称
export function GetParentBuName(uuid: any, params: { uuid: string }) {
  return service({
      url: '/itf/organization/web/business_unit/parent/uuid/'+ uuid,
      method: 'get',
      params
  })
}

// 员工查询列表
export function GetEmployee(params: {}) {
  return service({
    url: '/itf/employee/web/employee',
    method: 'get',
    params
  })
}

// 单元类型删除
export function DeleteBusinessUnitUuid(params: {uuid: string}) {
  return service({
      url: '/itf/organization/web/business_unit/uuid/'+ params.uuid,
      method: 'delete'
  })
}

/**
 * 职位根据uuid查询详情
 * @param params 
 * @returns 
 */
export function GetPositionInfo(uuid: any) {
  return service({
    url: `/itf/organization/web/position/uuid/${uuid}`,
    method: 'get'
  })
}

// 组织信息导出
export function PostOrganizationExport(params: any) {
  return service({
      url: '/itf/organization/web/business_unit/export',
      method: 'get',
      responseType: 'blob',
      params
  })
}

// 企业信息导出
export function PosteEterpriseExport(params: {}) {
  return service({
      url: '/itf/organization/web/enterprise/export',
      method: 'get',
      responseType: 'blob',
      params
  })
}
// --------------------- Service Order ----------------------
export function GetOrganizationServiceOrderList(params: {}) {
  return service({
      url: '/itf/organization/web/service/order/page',
      method: 'get',
      params
  })
}

// 不分页
export function GetOrganizationServiceOrderPage(params: {}) {
  return service({
      url: '/itf/organization/web/service/order',
      method: 'get',
      params
  })
}

// Service Order编辑
export function PutOrganizationServiceOrderUuid(params: { uuid: string }) {
  return service({
      url: '/itf/organization/web/service/order/uuid/'+ params.uuid,
      method: 'put',
      data: params
  })
}

// Service Order新增
export function PostOrganizationServiceOrderAdd(data: any) {
  return service({
      url: '/itf/organization/web/service/order',
      method: 'post',
      data
  })
}

// 根据id查询详情
export function GetOrganizationServiceOrderUuid(id: any) {
  return service({
      url: '/itf/organization/web/service/order/uuid/' + id,
      method: 'get'
  })
}

// 删除
export function DeleteOrganizationServiceOrder(data: { uuid: string }) {
  return service({
      url: '/itf/organization/web/service/order/uuid/'+ data.uuid,
      method: 'delete'
  })
}
